﻿@{
    ViewData["Title"] = "添加产品分类";
    Layout = "_layout";
    var Type = ViewBag.type as List<BuyWithoutLoseMoney.Core.Models.ProductType>;
}
@model List<BuyWithoutLoseMoney.Core.Models.ProductType>

<div>
    <div class="layui-card">
        <div class="layui-card-header">添加产品分类</div>
        <div class="layui-card-body">
            <form class="layui-form">
                <div class="layui-form-item">
                    <label class="layui-form-label">第一级产品分类名</label>
                    <div class="layui-input-block">
                        <input type="text" name="FirstTypeName" required lay-verify="required" placeholder="请输入第一级产品分类名" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">第二级产品分类名</label>
                    <div class="layui-input-block">
                        <input type="text" name="SecondTypeName" required lay-verify="required" placeholder="请输入第二级产品分类名" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item layui-form-text">
                    <label class="layui-form-label">第三级产品分类名</label>
                    <div class="layui-input-block">
                        <input type="text" name="ThirdTypeName" required lay-verify="required" placeholder="请输入第三级产品分类名" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit lay-filter="addForm">立即提交</button>
                        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
 @section Scripts{
    <script>
        layui.use(["form", 'layer', 'laydate'], function () {
            var form = layui.form;
            var $ = layui.$;
            var layer = layui.layer;
            var laydate = layui.laydate;
           
            //提交
            form.on('submit(addForm)', function (data) {
                $.post("/admin/proudctcategory/create", data.field, function (res) {
                    if (res.isSuccess) {
                        layer.msg(res.msg, function () {
                            parent.window.location.href = "/admin/proudctcategory/index";
                        });
                    } else {
                        layer.msg(res.msg);
                    }
                });
                return false;
            });
        })
    </script>
    }